const Sequelize = require("sequelize");
const sequelize = require("../config/database.js");
const Spot = require("../models/Spot");
const City = sequelize.define("city", {
  id: {
    type: Sequelize.INTEGER,
    autoIncrement: true,
    primaryKey: true,
  },
  name: {
    type: Sequelize.STRING,
    allowNull: false,
  },
  country: {
    type: Sequelize.STRING,
    allowNull: false,
  },
  image: {
    type: Sequelize.STRING,
    allowNull: false,
  },
  hot: {
    type: Sequelize.BOOLEAN,
    defaultValue: false,
  },
});
// City.associate = (models) => {
//   City.hasMany(models.Spot, {
//     foreignKey: {
//       name: "spotId",
//       allowNull: false,
//     },
//     as: "spots",
//   });
//   return City;
// };
// City.hasMany(Spot);
module.exports = City;
